export function saveToLocal(id, key, val) {
  let seller = window.localStorage.__music__
  if (!seller) {
    seller = {}
    seller[id] = {}
  } else {
    seller = JSON.parse(seller)
    if (!seller[id]) {
      seller[id] = {}
    }
  }
  seller[id][key] = val
  window.localStorage.__music__ = JSON.stringify(seller)
}

export function loadFromLocal(id, key, def) {
  if (!id) return false
  let seller = window.localStorage.__music__
  if (!seller) return def
  seller = JSON.parse(seller)
  if (!seller[id]) return def
  return seller[id][key]
}
